package com.cf.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cf.domain.pojo.TeamMember;
import com.cf.mapper.TeamMemberMapper;
import com.cf.service.ITeamMemberService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeamMemberServiceImpl extends ServiceImpl<TeamMemberMapper, TeamMember> implements ITeamMemberService {
    @Override
    public List<TeamMember> listByTeamId(Long teamId) {
        return lambdaQuery().eq(TeamMember::getTeamId, teamId).list();
    }

    @Override
    public List<TeamMember> listByUserId(Long userId) {
        return lambdaQuery().eq(TeamMember::getUserId, userId).list();
    }

    @Override
    public int updateTeamMember(TeamMember teamMember) {
        return baseMapper.updateTeamMember(teamMember.getId(), teamMember.getMemberName(), teamMember.getMemberPhone(), teamMember.getMemberEmail());
    }

    @Override
    public int deleteTeamMemberByTeamId(Long teamId) {
        return baseMapper.deleteTeamMemberByTeamId(teamId);
    }
}
